package com.myStudy.demo.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.myStudy.demo.service.DemoService;
import com.myStudy.mvcframework.annotation.MyAutowired;
import com.myStudy.mvcframework.annotation.MyController;
import com.myStudy.mvcframework.annotation.MyRequestMapping;
import com.myStudy.mvcframework.annotation.MyRequestParam;

@MyController
@MyRequestMapping("/demo")
public class DemoController {

	@MyAutowired
	private DemoService demoService;

	@MyRequestMapping("/hello")
	public void hello(HttpServletRequest req, HttpServletResponse resp, @MyRequestParam("name") String name) {
		String result = demoService.hello(name);
		try {
			resp.getWriter().write(result);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
